package com.augurit.gzcgwsp.qyzz.dao;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.augurit.common.base.dao.BaseDao;
import com.augurit.gzcgwsp.qyzz.entity.YwRqQyzzAzWxRyZs;
import com.augurit.gzcgwsp.qyzz.entity.YwRqRyzzEquipment;
/**
 * /**
 *  企业资质--企业主要设备与检测设备 dao类
 * @author 张军
 *
 */
@Repository
public class YwRqQyzzEquipmentDao extends BaseDao<YwRqRyzzEquipment, Long> {

	/**
	 * 查询燃气燃烧器具安装维修人员持证
	 * @param qyid
	 * @param acceptNo
	 * @return
	 */
	public List<YwRqRyzzEquipment> getEquipments(long qyid, String acceptNo) {
		Session session=this.getSession();
		Criteria criteria=session.createCriteria(YwRqRyzzEquipment.class);
		criteria.add(Restrictions.eq("qyid", qyid));
		criteria.add(Restrictions.eq("acceptNo", acceptNo));
		return criteria.list();
	}
	
	
	public YwRqRyzzEquipment getEntity(long id) {
		Session session=this.getSession();
		Criteria criteria=session.createCriteria(YwRqRyzzEquipment.class);
		criteria.add(Restrictions.eq("id", id));
		List<YwRqRyzzEquipment> list=(List<YwRqRyzzEquipment>) criteria.list();
		if(list!=null &&list.size()>0)
			return list.get(0);
		
		else
			return null;
	}
}